package com.design03_behavioral.pattern23_mediator.example01;

/**
 * @ClassName Client
 * @Description TODO
 * @Author 22963
 * @DATE 2023/9/11 1:18
 */
public class Client {

    public static void main(String[] args) {

        //创建中介者
        Mediator mediator = new MediatorImpl();
        //创建同事对象
        Colleague c1 = new ConcreteColleagueA(mediator);
        c1.exec("key-A");
        Colleague c2 = new ConcreteColleagueB(mediator);
        c2.exec("key-B");

        //====在组件A中,通过中介者执行!
        //最终中介者执行操作,key为: key-A
        //====在组件B中,通过中介者执行!
        //最终中介者执行操作,key为: key-B
    }

}
